<template>
  <div class="container">
    <Search title="无限群发" @search="onSearch" @reset="onReset" @create="onCreate" @setting="onSetting" />
    <Table :fetch-params="state.search" />
  </div>
</template>

<script setup lang="ts">
  import Search from '@renderer/components/search'
  import Table from './components/Table'

  import { reactive } from 'vue'
  import { useRouter } from 'vue-router'
  const router = useRouter()
  const state = reactive({
    search: {
      Title: '',
      CreatedBetween: [],
      Statue: 0 // 0 全部 1 未开始 2 运行中 3 已暂停 4 已完成
    }
  })
  const onSearch = (v: any) => {
    state.search = { ...state.search, ...v }
  }
  const onReset = (v: any) => {
    state.search = { ...state.search, ...v }
  }
  const onCreate = () => {
    console.log('创建', router)
    router.push('/infinite-send/create')
  }
  const onSetting = () => {
    console.log('任务设置', router)
    router.push('/infinite-send/taskSetting')
  }
</script>

<style scoped lang="scss">
  .container {
    padding: 10px;
    background: #fff;
  }
</style>
